import { Factory, Faker } from "@mikro-orm/seeder";
import { Users } from "../entities/Users";
import * as Mock from 'mockjs' 
import * as number from 'number-random'

export class UsersFactory extends Factory<Users> {
    model = Users;
  
    definition(faker: Faker): Partial<Users> {
      faker.setLocale('zh_CN')

        const name = `${faker.unique(faker.name.lastName)}${faker.name.firstName()}`
        const sex = faker.name.sex()

        return {
            name , //Mock.Random.cname(), 
            email: Mock.Random.email(),
            nickname:name,
            phoneNumber: faker.phone.number('###########'),
            idNumber : faker.random.numeric(18),
            headIconUrl : '/static/avatars/' +  number(1,64,false) + '.jpg',
            createdAt: new Date(),
            updatedAt: new Date(),
            address : Mock.Random.province(),
            roles: '[]',
      };
    }
  }